Skip to content

Add Jest E2E tests for trueforge-core - #431

Open
ramantehlan wants to merge 9 commits into
mainfrom
sd/e2e-test
Open

Add Jest E2E tests for trueforge-core#431
ramantehlan wants to merge 9 commits into
mainfrom
sd/e2e-test

Conversation

@ramantehlan

@ramantehlan ramantehlan commented Aug 25, 2026

Copy link
Copy Markdown

Summary

Adds a Jest E2E harness for @truefoundry/trueforge-core with a mocked LLM and a first orchestrator loop test.

Changes

  • Separate tests/e2e tree and jest.e2e.config.cjs, kept out of unit Jest
  • pnpm test:e2e / pnpm test:trueforge-core:e2e; core pnpm test runs units then E2E
  • Sample test: mocked text LLM, no tools, send + execute through AgentThreadOrchestrator

How was this tested?

  • pnpm --filter @truefoundry/trueforge-core test:e2e
  • pnpm --filter @truefoundry/trueforge-core typecheck

Checklist

  • I have read the contributing guidelines
  • pnpm build, pnpm test, pnpm typecheck, pnpm lint:ci, and pnpm format:check pass locally
  • Tests added/updated where it makes sense
  • No hand-edits to generated code (packages/trueforge-sdk, .github/fern/openapi/openapi.json, docs/openapi.json) — fork PRs omit SDK regen; maintainers regenerate after merge
  • Docs / .env.example updated if configuration or behavior changed

Note

Low Risk
Changes are limited to tests, Jest config, npm scripts, and editor launch settings; no production runtime or API behavior is modified.

Overview
Introduces a dedicated orchestration Jest harness under packages/trueforge-core/tests/orchestration that exercises AgentThreadOrchestrator and AgentThread with mocked LLMs and no store/DB, matching production’s send then execute flow.

Test wiring: jest.orchestration.config.cjs runs only that folder (maxWorkers: 1, 60s timeout); the default unit jest.config.cjs ignores tests/orchestration/. Core pnpm test now runs unit Jest then orchestration Jest. Root and package scripts add test:orchestration, test:orchestration:debug, and repo-level test:trueforge-core:orchestration (+ debug). VS Code launch config targets debugging the current orchestration test file.

Coverage added: shared helpers (runTurn, scripted ILLM streams, approval-gated write_note tool set) plus three scenarios—text-only happy path, create_sub_agent delegation with child result routed to parent, and pause/resume on tool approval. A README documents turn lifecycle, events, and how this maps to SessionHandle.

Reviewed by Cursor Bugbot for commit ee2791b. Bugbot is set up for automated code reviews on this repo. Configure here.

@changeset-bot

changeset-bot Bot commented Aug 25, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: ee2791b

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@chiragjn chiragjn added the core label Aug 26, 2026

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes using default effort and found 2 potential issues.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Want higher recall? High effort reviews run extra passes and find more bugs. A team admin can switch effort levels in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit a3b6b85. Configure here.

Comment thread packages/trueforge-core/tests/e2e/helpers/helpers.ts Outdated
Comment thread packages/trueforge-core/tests/e2e/orchestrationApproval.test.ts Outdated
required_actions: [EventType.TOOL_APPROVAL_REQUIRED],
root_agent_error: null,
},
context: [

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let us please make this as what is the input to LLM in turn 1.

},
];

const EXPECTED_CHILD_LLM_INPUT = [

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We do not need to test this at the moment.

If you test the root, we are mostly in good shape.


const EXPECTED_ROOT_LLM_INPUT = [
{
stream: true,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can skip this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants